import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'
import LayoutComponent from '@/layout'
import './App.css'
import { routers } from '@/router'
import { Empty } from 'antd'
export default function App() {
	// 登录验证
	const PrivateRoute = ({ children }) => {
		const login = true
		if (login) {
			return <>{children}</>
		} else {
			return <Navigate to="/login" replace />
		}
	}
	return (
		<BrowserRouter>
			<Routes>
				<Route path="/" element={<Navigate to="/home" replace />} />
				<Route
					element={<LayoutComponent />}
					children={routers.map((item) => (
						<Route
							path={item.path}
							element={
								// <PrivateRoute>
								item.element
								// </PrivateRoute>
							}
							key={item.key}
						/>
					))}
				/>
				<Route path="*" element={<Empty />} />
			</Routes>
		</BrowserRouter>
	)
}
